<?php

namespace App\BO\Product;

use App\Entities\ProductEntity;

/**
 * 按城市区分的产品
 * Class ProductBO
 * @package App\BO\Product
 */
class ProductBO
{
    /**
     * 产品基本信息
     * @var ProductEntity
     */
    private $baseProductInfo;

    /**
     * 产品按城市配置的特有信息
     * @var ProductEntity
     */
    private $cityProductInfo;

    /**
     * @param ProductEntity $baseProductInfo
     */
    public function setBaseProductInfo(ProductEntity $baseProductInfo): void
    {
        $this->baseProductInfo = $baseProductInfo;
    }

    /**
     * @return ProductEntity
     */
    public function getBaseProductInfo(): ProductEntity
    {
        return $this->baseProductInfo;
    }

    /**
     * @param ProductEntity $cityProductInfo
     */
    public function setCityProductInfo(ProductEntity $cityProductInfo): void
    {
        $this->cityProductInfo = $cityProductInfo;
    }

    /**
     * @return ProductEntity
     */
    public function getCityProductInfo(): ProductEntity
    {
        return $this->cityProductInfo;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->baseProductInfo->getId();
    }

    /**
     * @return int
     */
    public function getOnSale()
    {
        return $this->baseProductInfo->getOnSale();
    }

    /**
     * @return string
     */
    public function getPrice()
    {
        return (string)$this->baseProductInfo->getPrice();
    }

    /**
     * @return string
     */
    public function getTitle()
    {
        return $this->baseProductInfo->getTitle();
    }

    /**
     * @return string
     */
    public function getBType()
    {
        return $this->baseProductInfo->getBType();
    }

    /**
     * @return int
     */
    public function getProductCategoryId()
    {
        return $this->baseProductInfo->getProductCategoryId();
    }

    /**
     * @return string
     */
    public function getOrderImage()
    {
        return $this->cityProductInfo->getOrderImage();
    }

    /**
     * @return string
     */
    public function getProductShowType()
    {
        return $this->cityProductInfo->getProductShowType();
    }

    /**
     * @return string
     */
    public function getBannerImage()
    {
        return $this->cityProductInfo->getImage();
    }

    /**
     * @return string[]
     */
    public function getBanner()
    {
        $img = $this->getBannerImage();
        if (!$img) {
            return [];
        }
        return [$img];
    }

    /**
     * @return string
     */
    public function getCityProductMenuImage()
    {
        return $this->cityProductInfo->getProductMenuImage();
    }

    /**
     * @return int
     */
    public function getCityProductOpenCityConfig()
    {
        return $this->cityProductInfo->getProductOpenCityConfig();
    }

    /**
     * @return string
     */
    public function getProductDesc()
    {
        return $this->cityProductInfo->getProductDesc();
    }

    /**
     * @return string
     */
    public function getCityProductBuyNumLeftDesc()
    {
        return $this->cityProductInfo->getProductBuyNumLeftDesc();
    }

    /**
     * @return string
     */
    public function getDescription()
    {
        return $this->cityProductInfo->getDescription();
    }

    /**
     * @return string
     */
    public function getSpecification()
    {
        return $this->cityProductInfo->getSpecification();
    }
}
